
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>章节十一:数组 · 组团学</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="李航老师">
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-code/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-back-to-top-button/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search-pro/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-flexible-alerts/style.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-chapter-fold/chapter-fold.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-theme-lou/lou.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="chapter12.html" />
    
    
    <link rel="prev" href="chapter10.html" />
    

    </head>
    <body>
         

<div class="book">
  <div class="header-inner">
    <!-- LOGO -->
    <div class="logo"></div>
    <span class="title"></span>

    <!-- Search -->
    
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>


    <!-- Nav -->
    <ul class="header-nav">
      <li>
        <a href="https://space.bilibili.com/378936143" target="_blank">B站</a>
      </li><li>
        <a href="https://mp.weixin.qq.com/mp/profile_ext?action=home&__biz=MzIzMjY0NjU5Ng==&scene=124#wechat_redirect" target="_blank">公众号</a>
      </li><li>
        <a href="https://edu.csdn.net/course/detail/32032" target="_blank">CSDN</a>
      </li>
    </ul>
  </div>

  <div class="book-summary">
    <div class="book-summary-title">文档目录</div>
     
    <nav role="navigation">


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    简介
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" >
            
                <span>
            
                    
                    c语言程序设计
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="chapter1.html">
            
                <a href="chapter1.html">
            
                    
                    章节一:初识C语言程序
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="chapter2.html">
            
                <a href="chapter2.html">
            
                    
                    章节二:常用数据类型(整数)
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="chapter3.html">
            
                <a href="chapter3.html">
            
                    
                    章节三:常用数据类型(浮点型)
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4" data-path="chapter4.html">
            
                <a href="chapter4.html">
            
                    
                    章节四:数据类型转换
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.5" data-path="chapter5.html">
            
                <a href="chapter5.html">
            
                    
                    章节五:运算符
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.6" data-path="chapter6.html">
            
                <a href="chapter6.html">
            
                    
                    章节六:选择结构
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.7" data-path="chapter7.html">
            
                <a href="chapter7.html">
            
                    
                    章节七:switch
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.8" data-path="chapter8.html">
            
                <a href="chapter8.html">
            
                    
                    章节八:for循环
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.9" data-path="chapter9.html">
            
                <a href="chapter9.html">
            
                    
                    章节九:嵌套for循环
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.10" data-path="chapter10.html">
            
                <a href="chapter10.html">
            
                    
                    章节十:强化练习
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.2.11" data-path="chapter11.html">
            
                <a href="chapter11.html">
            
                    
                    章节十一:数组
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.12" data-path="chapter12.html">
            
                <a href="chapter12.html">
            
                    
                    章节十二:数组函数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.13" data-path="chapter13.html">
            
                <a href="chapter13.html">
            
                    
                    章节十三:函数
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" >
            
                <span>
            
                    
                    html基础
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../html/Html基础标签1.html">
            
                <a href="../html/Html基础标签1.html">
            
                    
                    章节一:Html基础标签1
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../html/Html基础标签2.html">
            
                <a href="../html/Html基础标签2.html">
            
                    
                    章节二:Html基础标签2
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" >
            
                <span>
            
                    
                    Flask Web开发
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../flask/chapter1.html">
            
                <a href="../flask/chapter1.html">
            
                    
                    章节一:flask框架入门
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../flask/chapter2.html">
            
                <a href="../flask/chapter2.html">
            
                    
                    章节二:模版渲染
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="../flask/chapter3.html">
            
                <a href="../flask/chapter3.html">
            
                    
                    章节三:html基本标签
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="../flask/chapter4.html">
            
                <a href="../flask/chapter4.html">
            
                    
                    章节四:项目拆分
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5" data-path="../flask/chapter5.html">
            
                <a href="../flask/chapter5.html">
            
                    
                    章节五:路由参数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.6" data-path="../flask/chapter6.html">
            
                <a href="../flask/chapter6.html">
            
                    
                    章节六:请求与响应
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.7" data-path="../flask/chapter7.html">
            
                <a href="../flask/chapter7.html">
            
                    
                    章节七:flask-Cookie
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.8" data-path="../flask/chapter8.html">
            
                <a href="../flask/chapter8.html">
            
                    
                    章节八:模型数据
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.9" data-path="../flask/chapter9.html">
            
                <a href="../flask/chapter9.html">
            
                    
                    章节九:单表-增删查改一
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.10" data-path="../flask/chapter10.html">
            
                <a href="../flask/chapter10.html">
            
                    
                    章节十:单表-增删查改二
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.11" data-path="../flask/chapter11.html">
            
                <a href="../flask/chapter11.html">
            
                    
                    章节十一:图书管理系统
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" >
            
                <span>
            
                    
                    gitbook文档搭建
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="../book/chapter1.html">
            
                <a href="../book/chapter1.html">
            
                    
                    章节一:环境安装
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="../book/chapter2.html">
            
                <a href="../book/chapter2.html">
            
                    
                    章节二:typora使用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="../book/chapter3.html">
            
                <a href="../book/chapter3.html">
            
                    
                    章节三:电子书搭建
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.4" data-path="../book/chapter4.html">
            
                <a href="../book/chapter4.html">
            
                    
                    章节四:插件安装
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.5" data-path="../book/chapter5.html">
            
                <a href="../book/chapter5.html">
            
                    
                    章节五:部署
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>

</nav>
     
  </div>

  <!-- Content nav -->
  <div class="book-anchor">
    <div class="book-anchor-title"></div>

    <div class="book-anchor-body"></div>
  </div>

  <div class="book-body">
    
    <div class="body-inner">
       

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >章节十一:数组</a>
    </h1>
</div>



      <div class="page-wrapper" tabindex="-1" role="main">
        <div class="page-inner">
          
<div id="book-search-results">
    <div class="search-noresults">
    
          <section class="normal markdown-section">
             <h2 id="&#x6570;&#x7EC4;">&#x6570;&#x7EC4;</h2>
<p>&#x6982;&#x5FF5;:&#x5728;&#x8BA1;&#x7B97;&#x673A;&#x4E2D;&#x5F00;&#x8F9F;&#x4E00;&#x5757;&#x8FDE;&#x7EED;&#x7684;&#x5185;&#x5B58;&#x7A7A;&#x95F4;&#x5B58;&#x50A8;&#x6570;&#x636E;&#x3002;&#x4E14; &#x5B58;&#x50A8;&#x7684;&#x6570;&#x636E;&#x4E00;&#x5B9A;&#x8981;&#x662F;&#x76F8;&#x540C;&#x7684;&#x7C7B;&#x578B;
&#x6570;&#x7EC4;&#x8BED;&#x6CD5;: &#x6570;&#x636E;&#x7C7B;&#x578B; &#x6570;&#x7EC4;&#x540D;[&#x957F;&#x5EA6;]; &#x4F8B;&#x5982;: int a[3];
&#x5B58;&#x50A8;&#x6570;&#x636E;: &#x6570;&#x7EC4;&#x540D;[&#x7D22;&#x5F15;]=&#x503C;&#xFF1B;
&#x83B7;&#x53D6;&#x6570;&#x7EC4;&#x6570;&#x636E;: &#x6570;&#x7EC4;[&#x7D22;&#x5F15;];</p>
<h2 id="&#x5B58;&#x50A8;&#x6570;&#x636E;-&#x6848;&#x4F8B;1">&#x5B58;&#x50A8;&#x6570;&#x636E;-&#x6848;&#x4F8B;1</h2>
<p>&#x5B9A;&#x4E49;&#x6570;&#x7EC4;&#x3001;&#x5B58;&#x50A8;&#x6570;&#x636E;&#x3001;&#x83B7;&#x53D6;&#x6570;&#x636E;</p>
<pre><code class="lang-c"><span class="hljs-function"><span class="hljs-keyword">int</span> <span class="hljs-title">m1</span><span class="hljs-params">()</span></span>{
    <span class="hljs-comment">//1.&#x5B9A;&#x4E49;&#x4E00;&#x4E2A;&#x6570;&#x7EC4;</span>
    <span class="hljs-keyword">int</span> a[<span class="hljs-number">3</span>];
    <span class="hljs-comment">//2.&#x5B58;&#x50A8;&#x6570;&#x636E;</span>
    a[<span class="hljs-number">0</span>]=<span class="hljs-number">18</span>;
    a[<span class="hljs-number">1</span>]=<span class="hljs-number">19</span>;
    a[<span class="hljs-number">2</span>]=<span class="hljs-number">10</span>;

    <span class="hljs-comment">//3.&#x6253;&#x5370;&#x6570;&#x7EC4;&#x4E2D;&#x7684;&#x6570;&#x636E;</span>
    <span class="hljs-built_in">printf</span>(<span class="hljs-string">&quot;%d\n&quot;</span>,a[<span class="hljs-number">1</span>]);<span class="hljs-comment">//19</span>
    <span class="hljs-built_in">printf</span>(<span class="hljs-string">&quot;%d\n&quot;</span>,a[<span class="hljs-number">0</span>]);<span class="hljs-comment">//18</span>
    <span class="hljs-built_in">printf</span>(<span class="hljs-string">&quot;%d\n&quot;</span>,a[<span class="hljs-number">2</span>]);<span class="hljs-comment">//10</span>

    <span class="hljs-keyword">return</span> <span class="hljs-number">0</span>;
}
</code></pre>
<h2 id="&#x5FAA;&#x73AF;&#x83B7;&#x53D6;&#x6570;&#x7EC4;&#x6570;&#x636E;-&#x6848;&#x4F8B;2">&#x5FAA;&#x73AF;&#x83B7;&#x53D6;&#x6570;&#x7EC4;&#x6570;&#x636E;-&#x6848;&#x4F8B;2</h2>
<pre><code class="lang-c"><span class="hljs-function"><span class="hljs-keyword">int</span> <span class="hljs-title">m1</span><span class="hljs-params">()</span></span>{
    <span class="hljs-comment">//1.&#x5B9A;&#x4E49;&#x6570;&#x7EC4; &#x957F;&#x5EA6;&#x662F;3</span>
    <span class="hljs-keyword">int</span> nums[]={<span class="hljs-number">3</span>,<span class="hljs-number">6</span>,<span class="hljs-number">9</span>},i;
    <span class="hljs-comment">//2.&#x83B7;&#x53D6;&#x6570;&#x636E;</span>
    <span class="hljs-built_in">printf</span>(<span class="hljs-string">&quot;&#x7B2C;&#x4E00;&#x4E2A;&#x6570;&#x636E;:%d\n&quot;</span>,nums[<span class="hljs-number">0</span>]);
    <span class="hljs-built_in">printf</span>(<span class="hljs-string">&quot;&#x7B2C;&#x4E8C;&#x4E2A;&#x6570;&#x636E;:%d\n&quot;</span>,nums[<span class="hljs-number">1</span>]);
    <span class="hljs-built_in">printf</span>(<span class="hljs-string">&quot;&#x7B2C;&#x4E09;&#x4E2A;&#x6570;&#x636E;:%d\n&quot;</span>,nums[<span class="hljs-number">2</span>]);
    <span class="hljs-built_in">printf</span>(<span class="hljs-string">&quot;&#x6839;&#x636E;&#x5FAA;&#x73AF;&#x7684;&#x65B9;&#x5F0F;&#x83B7;&#x53D6;&#x6570;&#x636E;:\n&quot;</span>);
    <span class="hljs-keyword">for</span>(i=<span class="hljs-number">0</span>;i&lt;=<span class="hljs-number">2</span>;i++){
        <span class="hljs-built_in">printf</span>(<span class="hljs-string">&quot;&#x7B2C;%d&#x4E2A;&#x6570;&#x636E;:%d\n&quot;</span>,i+<span class="hljs-number">1</span>,nums[i]);
    }    

    <span class="hljs-keyword">return</span> <span class="hljs-number">0</span>;
}
</code></pre>
<h2 id="&#x4FEE;&#x6539;&#x7D20;&#x7EC4;&#x6570;&#x636E;-&#x6848;&#x4F8B;3">&#x4FEE;&#x6539;&#x7D20;&#x7EC4;&#x6570;&#x636E;-&#x6848;&#x4F8B;3</h2>
<pre><code class="lang-c"><span class="hljs-function"><span class="hljs-keyword">int</span> <span class="hljs-title">m3</span><span class="hljs-params">()</span></span>{
    <span class="hljs-comment">//&#x6848;&#x4F8B;-&#x4FEE;&#x6539;&#x6570;&#x636E;</span>
    <span class="hljs-keyword">int</span> str[]={<span class="hljs-number">4</span>,<span class="hljs-number">5</span>,<span class="hljs-number">6</span>,<span class="hljs-number">7</span>};
    <span class="hljs-keyword">int</span> str1[<span class="hljs-number">5</span>]={<span class="hljs-number">1</span>,<span class="hljs-number">3</span>};<span class="hljs-comment">//&#x957F;&#x5EA6;&#x4E3A;5 &#x6570;&#x636E;&#x53EA;&#x6709;2&#x4E2A;,&#x6D4B;&#x8BD5;&#x4F60;&#x9ED8;&#x8BA4;&#x503C;: int&#x7C7B;&#x578B;&#x9ED8;&#x8BA4;&#x503C;0  </span>
    <span class="hljs-keyword">float</span> str2[<span class="hljs-number">5</span>]={<span class="hljs-number">3</span>,<span class="hljs-number">4</span>};<span class="hljs-comment">//float &#x9ED8;&#x8BA4;&#x503C;;0.0</span>
    <span class="hljs-comment">//&#x4FEE;&#x6539;str&#x7684;&#x6570;&#x636E; &#x5C06; 4&#x4FEE;&#x6539;&#x6210;8  &#x5C06;7&#x4FEE;&#x6539;&#x6210;16</span>
    str[<span class="hljs-number">0</span>]=<span class="hljs-number">8</span>;
    str[<span class="hljs-number">3</span>]=<span class="hljs-number">16</span>;
    <span class="hljs-built_in">printf</span>(<span class="hljs-string">&quot;%d\t%d\t%d\t%d\n&quot;</span>,str[<span class="hljs-number">0</span>],str[<span class="hljs-number">1</span>],str[<span class="hljs-number">2</span>],str[<span class="hljs-number">3</span>]);
    <span class="hljs-built_in">printf</span>(<span class="hljs-string">&quot;int&#x9ED8;&#x8BA4;&#x503C;:%d\n&quot;</span>,str1[<span class="hljs-number">4</span>]);<span class="hljs-comment">//0</span>
    <span class="hljs-built_in">printf</span>(<span class="hljs-string">&quot;float&#x9ED8;&#x8BA4;&#x503C;:%.2f\n&quot;</span>,str2[<span class="hljs-number">4</span>]);<span class="hljs-comment">//0.0</span>
    <span class="hljs-keyword">return</span> <span class="hljs-number">0</span>;
}
</code></pre>
<h2 id="&#x6570;&#x7EC4;&#x4E0E;&#x5FAA;&#x73AF;&#x6848;&#x4F8B;-&#x6848;&#x4F8B;4">&#x6570;&#x7EC4;&#x4E0E;&#x5FAA;&#x73AF;&#x6848;&#x4F8B;-&#x6848;&#x4F8B;4</h2>
<pre><code class="lang-c"><span class="hljs-function"><span class="hljs-keyword">int</span> <span class="hljs-title">m2</span><span class="hljs-params">()</span></span>{
    <span class="hljs-comment">//&#x901A;&#x8FC7;&#x5FAA;&#x73AF;&#x7684;&#x65B9;&#x5F0F;&#x5B58;&#x50A8;5&#x540D;&#x5B66;&#x751F;&#x7684;&#x6210;&#x7EE9;&#xFF0C;&#x8BA1;&#x7B97;5&#x540D;&#x5B66;&#x751F;&#x7684;&#x603B;&#x6210;&#x7EE9;</span>
    <span class="hljs-keyword">int</span> score[<span class="hljs-number">5</span>],i,j,sum=<span class="hljs-number">0</span>;<span class="hljs-comment">//&#x4FDD;&#x5B58;&#x6210;&#x7EE9;&#x7684;&#x6570;&#x7EC4;</span>
    <span class="hljs-keyword">for</span>(i=<span class="hljs-number">0</span>;i&lt;=<span class="hljs-number">4</span>;i++){
        <span class="hljs-built_in">printf</span>(<span class="hljs-string">&quot;&#x8BF7;&#x8F93;&#x5165;&#x7B2C;%d&#x540D;&#x5B66;&#x751F;&#x7684;&#x6210;&#x7EE9;:\n&quot;</span>,i+<span class="hljs-number">1</span>);
        <span class="hljs-built_in">scanf</span>(<span class="hljs-string">&quot;%d&quot;</span>,&amp;score[i]);
        sum=sum+score[i];<span class="hljs-comment">//&#x6C42;&#x6570;&#x7EC4;&#x7684;&#x548C;</span>
    }

    <span class="hljs-comment">//&#x6253;&#x5370;&#x6570;&#x7EC4;</span>
    <span class="hljs-keyword">for</span>(j=<span class="hljs-number">0</span>;j&lt;=<span class="hljs-number">4</span>;j++){
        <span class="hljs-built_in">printf</span>(<span class="hljs-string">&quot;%d\n&quot;</span>,score[j]);
    }
    <span class="hljs-built_in">printf</span>(<span class="hljs-string">&quot;5&#x540D;&#x5B66;&#x751F;&#x7684;&#x603B;&#x6210;&#x7EE9;&#x662F;:%d\n&quot;</span>,sum);
    <span class="hljs-keyword">return</span> <span class="hljs-number">0</span>;

}
</code></pre>
<h2 id="&#x6210;&#x7EE9;&#x7EDF;&#x8BA1;-&#x6848;&#x4F8B;5">&#x6210;&#x7EE9;&#x7EDF;&#x8BA1;-&#x6848;&#x4F8B;5</h2>
<pre><code class="lang-c">
<span class="hljs-function"><span class="hljs-keyword">int</span> <span class="hljs-title">m2</span><span class="hljs-params">()</span></span>{
    <span class="hljs-comment">//&#x8F93;&#x5165;10&#x540D;&#x5B66;&#x751F;&#x7684;&#x6210;&#x7EE9;&#xFF0C;&#x7EDF;&#x8BA1;80-100&#x5206;&#x7684;&#x4EBA;&#x6570; 60-80&#x5206;&#x7684;&#x4EBA;&#x6570; &#x4F4E;&#x4E8E;60&#x5206;&#x7684;&#x4EBA;&#x6570;</span>
    <span class="hljs-keyword">int</span> score[<span class="hljs-number">10</span>],i,s,j,m1=<span class="hljs-number">0</span>,m2=<span class="hljs-number">0</span>,m3=<span class="hljs-number">0</span>,n;<span class="hljs-comment">//score &#x6570;&#x7EC4;&#x6210;&#x7EE9;   m1=80-100  m2= 60-80 m3=&#x4F4E;&#x4E8E;60&#x5206;</span>
    <span class="hljs-keyword">for</span>(i=<span class="hljs-number">0</span>;i&lt;<span class="hljs-number">10</span>;i++){
        <span class="hljs-built_in">printf</span>(<span class="hljs-string">&quot;&#x8BF7;&#x8F93;&#x5165;&#x7B2C;%d&#x540D;&#x5B66;&#x751F;&#x7684;&#x6210;&#x7EE9;:\n&quot;</span>,i+<span class="hljs-number">1</span>);
        <span class="hljs-built_in">scanf</span>(<span class="hljs-string">&quot;%d&quot;</span>,&amp;s);<span class="hljs-comment">//&#x63A5;&#x6536;&#x6210;&#x7EE9;</span>
        score[i]=s;<span class="hljs-comment">//&#x4FDD;&#x5B58;&#x6210;&#x7EE9;</span>
    }
    <span class="hljs-comment">//&#x6253;&#x5370;&#x6210;&#x7EE9;</span>
    <span class="hljs-built_in">printf</span>(<span class="hljs-string">&quot;&#x6253;&#x5370;&#x6210;&#x7EE9;&#x5982;&#x4E0B;:\n&quot;</span>);
    <span class="hljs-keyword">for</span>(j=<span class="hljs-number">0</span>;j&lt;<span class="hljs-number">10</span>;j++){
        <span class="hljs-built_in">printf</span>(<span class="hljs-string">&quot;%d\t&quot;</span>,score[j]);
    }
    <span class="hljs-built_in">printf</span>(<span class="hljs-string">&quot;\n&quot;</span>);<span class="hljs-comment">//&#x6362;&#x884C;</span>

    <span class="hljs-comment">//&#x7EDF;&#x8BA1;&#x4EBA;&#x6570;</span>
    <span class="hljs-keyword">for</span>(n=<span class="hljs-number">0</span>;n&lt;<span class="hljs-number">10</span>;n++){
        <span class="hljs-keyword">if</span>(score[n]&gt;=<span class="hljs-number">80</span>&amp;&amp;score[n]&lt;=<span class="hljs-number">100</span>){
            m1++;
        }<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span>(score[n]&gt;=<span class="hljs-number">60</span>&amp;&amp;score[n]&lt;<span class="hljs-number">80</span>){
            m2++;
        }<span class="hljs-keyword">else</span>{
            m3++;
        }
    }

    <span class="hljs-built_in">printf</span>(<span class="hljs-string">&quot;80-100&#x5206;&#x7684;&#x4EBA;&#x6570;&#xFF1A;%d\n&quot;</span>,m1);
    <span class="hljs-built_in">printf</span>(<span class="hljs-string">&quot;60-80&#x5206;&#x7684;&#x4EBA;&#x6570;&#xFF1A;%d\n&quot;</span>,m2);
    <span class="hljs-built_in">printf</span>(<span class="hljs-string">&quot;&#x4F4E;&#x4E8E;60&#x5206;&#x7684;&#x4EBA;&#x6570;&#xFF1A;%d\n&quot;</span>,m3);
    <span class="hljs-keyword">return</span> <span class="hljs-number">0</span>;
}
</code></pre>
<h2 id="&#x5B57;&#x7B26;&#x6570;&#x7EC4;&#x4E0E;&#x5B57;&#x7B26;&#x4E32;&#x6570;&#x7EC4;">&#x5B57;&#x7B26;&#x6570;&#x7EC4;&#x4E0E;&#x5B57;&#x7B26;&#x4E32;&#x6570;&#x7EC4;</h2>
<pre><code class="lang-c"><span class="hljs-comment">//1.&#x5B57;&#x7B26;&#x6570;&#x7EC4;  char</span>
<span class="hljs-function"><span class="hljs-keyword">int</span> <span class="hljs-title">m1</span><span class="hljs-params">()</span></span>{
    <span class="hljs-keyword">char</span> a[<span class="hljs-number">4</span>]={<span class="hljs-string">&apos;A&apos;</span>,<span class="hljs-string">&apos;B&apos;</span>,<span class="hljs-string">&apos;C&apos;</span>,<span class="hljs-string">&apos;d&apos;</span>}; <span class="hljs-comment">//&#x957F;&#x5EA6;&#x5C31;&#x662F;4</span>
    <span class="hljs-keyword">int</span> i;
    <span class="hljs-keyword">for</span>(i=<span class="hljs-number">0</span>;i&lt;=<span class="hljs-number">3</span>;i++){
        <span class="hljs-comment">//printf(&quot;&#x6253;&#x5370;&#x6570;&#x636E;&#x6709;:%c\n&quot;,a[i]);</span>
        <span class="hljs-built_in">printf</span>(<span class="hljs-string">&quot;&#x6253;&#x5370;&#x6570;&#x636E;&#x6709;:%d\n&quot;</span>,a[i]);
    }
    <span class="hljs-built_in">printf</span>(<span class="hljs-string">&quot;&#x7ED3;&#x679C;:%c\n&quot;</span>,a[<span class="hljs-number">4</span>]);<span class="hljs-comment">//0</span>
    <span class="hljs-keyword">return</span> <span class="hljs-number">0</span>;
}

------------------------------------------------------------------------------------
<span class="hljs-comment">//2.&#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x5B57;&#x7B26;&#x4E32;&#x6570;&#x7EC4;:</span>
<span class="hljs-function"><span class="hljs-keyword">int</span> <span class="hljs-title">m2</span><span class="hljs-params">()</span></span>{
    <span class="hljs-keyword">char</span> a[<span class="hljs-number">14</span>]={<span class="hljs-string">&quot;my name is abc&quot;</span>};<span class="hljs-comment">// a[0]&#x7B49;&#x4E8E;m</span>
    <span class="hljs-keyword">char</span> b[]=<span class="hljs-string">&quot;my name is abc&quot;</span>;<span class="hljs-comment">//&#x957F;&#x5EA6;&#x662F;14 + &#x7ED3;&#x675F;&#x7B26; &apos;\0&apos; =&#x957F;&#x5EA6;15</span>
    <span class="hljs-keyword">int</span> i;
    <span class="hljs-keyword">for</span>(i=<span class="hljs-number">0</span>;i&lt;=<span class="hljs-number">13</span>;i++){
        <span class="hljs-built_in">printf</span>(<span class="hljs-string">&quot;%c\n&quot;</span>,a[i]);
    }
    <span class="hljs-keyword">for</span>(i=<span class="hljs-number">0</span>;i&lt;=<span class="hljs-number">13</span>;i++){
        <span class="hljs-built_in">printf</span>(<span class="hljs-string">&quot;%c\n&quot;</span>,b[i]);
    }
    <span class="hljs-built_in">printf</span>(<span class="hljs-string">&quot;&#x7ED3;&#x679C;:%c\n&quot;</span>,b[<span class="hljs-number">14</span>]);<span class="hljs-comment">// &#x7A7A;</span>

    <span class="hljs-keyword">return</span> <span class="hljs-number">0</span>;
}
</code></pre>
 
          </section>
          
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>
 
        </div>
      </div>
      
    </div>

     
    <a
      href="chapter10.html"
      class="navigation navigation-prev "
      aria-label="Previous page: 章节十:强化练习"
    >
      <i class="fa fa-angle-left"></i>
    </a>
     
    <a
      href="chapter12.html"
      class="navigation navigation-next "
      aria-label="Next page: 章节十二:数组函数"
    >
      <i class="fa fa-angle-right"></i>
    </a>
      
  </div>
  <script>
    function showModal() {
      document.getElementsByClassName("mask")[0].style.display = "block";
      document.getElementsByClassName("donate-modal")[0].style.display =
        "block";
    }
    // 切换赞赏码
    function showDonateImg(num) {
      let alipay = "";
      let wxpay = ""
      if(num){
        wxpay = "hidden"
      }else{
        alipay = "hidden"
      }
      document.getElementById("wxpay-code").hidden = wxpay;
      document.getElementById("alipay-code").hidden = alipay;
      document.getElementsByName("pay-way")[num].checked = "checked";
    }

    // 关闭赞赏框
    function closeDonateModal() {
      document.getElementsByClassName("mask")[0].style.display = "none";
      document.getElementsByClassName("donate-modal")[0].style.display = "none";
    }

    var gitbook = gitbook || [];
    gitbook.push(function () {
      gitbook.page.hasChanged({"page":{"title":"章节十一:数组","level":"1.2.11","depth":2,"next":{"title":"章节十二:数组函数","level":"1.2.12","depth":2,"path":"c/chapter12.md","ref":"c/chapter12.md","articles":[]},"previous":{"title":"章节十:强化练习","level":"1.2.10","depth":2,"path":"c/chapter10.md","ref":"c/chapter10.md","articles":[]},"dir":"ltr"},"config":{"plugins":["-lunr","-sharing","-search","-favicon","code","expandable-chapters","theme-lou","back-to-top-button","search-pro","flexible-alerts","chapter-fold","livereload"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"chapter-fold":{},"livereload":{},"search-pro":{},"code":{"copyButtons":true},"theme-lou":{"hide-elements":[".summary .gitbook-link"],"color":"#2096FF","copyright":{"author":"李航老师"},"forbidCopy":true,"logo":"assets/logo.png","titleColor":{"h1":"#8b008b","h2":"#20b2aa","h3":"#a52a2a"},"search-placeholder":"众里寻他千百度","copyrightLogo":"assets/copyright.png","favicon":"assets/favicon.ico","autoNumber":3},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"back-to-top-button":{},"flexible-alerts":{"style":"callout","note":{"label":"Note","icon":"fa fa-info-circle","className":"info"},"tip":{"label":"Tip","icon":"fa fa-lightbulb-o","className":"tip"},"warning":{"label":"Warning","icon":"fa fa-exclamation-triangle","className":"warning"},"danger":{"label":"Attention","icon":"fa fa-ban","className":"danger"}},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"expandable-chapters":{}},"theme":"default","author":"李航老师","lang":"zh-cn","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{"themeLou":{"nav":[{"target":"_blank","url":"https://space.bilibili.com/378936143","name":"B站"},{"target":"_blank","url":"https://mp.weixin.qq.com/mp/profile_ext?action=home&__biz=MzIzMjY0NjU5Ng==&scene=124#wechat_redirect","name":"公众号"},{"target":"_blank","url":"https://edu.csdn.net/course/detail/32032","name":"CSDN"}]}},"title":"组团学","gitbook":"*","description":"Gitbook电子书示例项目"},"file":{"path":"c/chapter11.md","mtime":"2023-12-28T06:37:06.965Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2023-12-28T06:53:31.689Z"},"basePath":"..","book":{"language":""}});
    });
  </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-code/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-back-to-top-button/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search-pro/jquery.mark.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search-pro/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-flexible-alerts/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-chapter-fold/chapter-fold.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-theme-lou/jweixin-1.6.0.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-theme-lou/lou.js"></script>
        
    

    </body>
</html>

